home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0060_VGA TEXT Support.pas < prev    next >
Pascal/Delphi Source File  |  1993-10-28  |  5KB  |  239 lines

  1. {===========================================================================
  2. Date: 10-09-93 (10:40)
  3. From: WIM VAN DER VEGT
  4. Subj: textmodes w/43/50 lines
  5. ---------------------------------------------------------------------------
  6. Here the uncodes sources of some routines I've written to replace
  7. turbo's internal textmode routines to enable 43 & 50 lines textmodes on
  8. VGA. They use the BIOS and can be combined with normal read/write
  9. statements. Just use the unit and call one of the Vgaxxlines routines.
  10.  
  11. {---------------------------------------------------------}
  12. {  Project : Vga Textmode Support                         }
  13. {  By      : G.W. van der Vegt                            }
  14. {---------------------------------------------------------}
  15. {  Date  .time  Revision                                  }
  16. {  931003.2200  Creatie.                                  }
  17. {---------------------------------------------------------}
  18.  
  19. Unit Vts_01;
  20.  
  21. Interface
  22.  
  23. Function  MaxX : Byte;
  24.  
  25. Function  MaxY : Byte;
  26.  
  27. Function  WhereX : Byte;
  28.  
  29. Function  WhereY : Byte;
  30.  
  31. Procedure GotoXY(x,y : Byte);
  32.  
  33. Function  GetXY(x,y : Byte) : Char;
  34.  
  35. Procedure vga50lines;
  36.  
  37. Procedure vga43lines;
  38.  
  39. Procedure vga25lines;
  40.  
  41. {---------------------------------------------------------}
  42.  
  43. Implementation
  44.  
  45. Uses
  46.   Dos;
  47.  
  48. {---------------------------------------------------------}
  49.  
  50. Function MaxX : Byte;
  51.  
  52. {----Return horizontal size of textmode in characters}
  53.  
  54. Var
  55.   r      : Registers;
  56.  
  57. Begin
  58.   r.ah:=$0F;
  59.   Intr($10,r);
  60.   MaxX:=r.AH;
  61. End; {of MaxX}
  62.  
  63. {---------------------------------------------------------}
  64.  
  65. Function MaxY : Byte;
  66.  
  67. {----Return vertical size of textmode in characters}
  68.  
  69. Var
  70.   r      : Registers;
  71.   buf    : Array[0..63] Of byte;
  72.  
  73. Begin
  74.   r.ah:=$1B;
  75.   r.bx:=$00;
  76.   r.es:=Seg(buf);
  77.   r.di:=Ofs(buf);
  78.   Intr($10,r);
  79.   MaxY:=buf[$22];
  80. End; {of MaxY}
  81.  
  82. {---------------------------------------------------------}
  83.  
  84. Function WhereX : Byte;
  85.  
  86. {----WhereX, aware of textmodes larger than 80x25}
  87.  
  88. Var
  89.   r : registers;
  90.  
  91. Begin
  92.   r.ah:=$0f;
  93.   Intr($10,r);
  94.   r.ah:=$03;
  95.   Intr($10,r);
  96.   WhereX:=r.dl;
  97. End; {of WhereX}
  98.  
  99. {---------------------------------------------------------}
  100.  
  101. Function WhereY : Byte;
  102.  
  103. {----WhereY, aware of textmodes larger than 80x25}
  104.  
  105.  
  106. Var
  107.   r : registers;
  108.  
  109. Begin
  110.   r.ah:=$0f;
  111.   Intr($10,r);
  112.   r.ah:=$03;
  113.   Intr($10,r);
  114.   WhereY:=r.dh;
  115. End; {of WhereY}
  116.  
  117. {---------------------------------------------------------}
  118.  
  119. Procedure GotoXY(x,y : Byte);
  120.  
  121. {----GotoXY, aware of textmodes larger than 80x25}
  122.  
  123. Var
  124.   r : registers;
  125.  
  126. Begin
  127.   r.ah:=$0f;
  128.   Intr($10,r);
  129.   r.ah:=$02;
  130.   r.dh:=y;
  131.   r.dl:=x;
  132.   Intr($10,r);
  133. End; {of GotoXY}
  134.  
  135. {---------------------------------------------------------}
  136.  
  137. Function GetXY(x,y : Byte) : Char;
  138.  
  139. {----GetXY, returns char at x,y and is aware of textmodes larger than 80x25}
  140. {           leave cursor unchanged.                                        }
  141.  
  142. Var
  143.   r     : registers;
  144.   xs,ys : Byte;
  145. Begin
  146.   xs:=WhereX;
  147.   ys:=WhereY;
  148.   GotoXY(x,y);
  149.   r.ah:=$0f;
  150.   Intr($10,r);
  151.   r.ah:=$08;
  152.   Intr($10,r);
  153.   GetXY:=Chr(r.al);
  154.   GotoXY(xs,ys);
  155. End; {of GotoXY}
  156.  
  157. {---------------------------------------------------------}
  158.  
  159. Procedure vga50lines;
  160.  
  161. {----Put VGA display into 80x50 textmode}
  162.  
  163. Var
  164.   r : registers;
  165.   b : Byte;
  166.  
  167. Begin
  168. {----50 line mode}
  169.   b:=Mem[$40:$87];
  170.   Mem[$40:$87]:=Mem[$40:$87] OR $01;
  171.   r.ah:=$11;
  172.   r.al:=$12; {----8x8 Character set}
  173.   r.bl:=$00;
  174.   Intr($10,r);
  175.   Mem[$40:$87]:=b;
  176.  
  177. {----400 scan lines neccesary}
  178.   r.ah:=$12;
  179.   r.al:=$02; {----400}
  180.   r.bl:=$30;
  181.   Intr($10,r);
  182. End; {of Vga50lines}
  183.  
  184. {---------------------------------------------------------}
  185.  
  186. Procedure vga43lines;
  187.  
  188. {----Put VGA display into 80x43 (EGA) textmode}
  189.  
  190. Var
  191.   r : registers;
  192.   b : Byte;
  193.  
  194. Begin
  195. {----43 line mode}
  196.   b:=Mem[$40:$87];
  197.   Mem[$40:$87]:=Mem[$40:$87] OR $01;
  198.   r.ah:=$11;
  199.   r.al:=$12; {----8x8 Character set}
  200.   r.bl:=$00;
  201.   Intr($10,r);
  202.   Mem[$40:$87]:=b;
  203.  
  204. {----350 scan lines neccesary}
  205.   r.ah:=$12;
  206.   r.al:=$01; {----350}
  207.   r.bl:=$30;
  208.   Intr($10,r);
  209. End; {of Vga43lines}
  210.  
  211. {---------------------------------------------------------}
  212.  
  213. Procedure vga25lines;
  214.  
  215. {----Put VGA display into 80x25 textmode}
  216.  
  217. Var
  218.   r : registers;
  219.   b : Byte;
  220.  
  221. Begin
  222. {----25 line mode}
  223.   b:=Mem[$40:$87];
  224.   Mem[$40:$87]:=Mem[$40:$87] OR $01;
  225.   r.ah:=$11;
  226.   r.al:=$11; {----8x14 Character set}
  227.   r.bl:=$00;
  228.   Intr($10,r);
  229.   Mem[$40:$87]:=b;
  230.  
  231. {----400 scan lines neccesary}
  232.   r.ah:=$12;
  233.   r.al:=$02; {----400}
  234.   r.bl:=$30;
  235.   Intr($10,r);
  236. End; {of Vga25lines}
  237.  
  238. End.
  239.